package ${package1}.${package2}.${package3}.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import ${package1}.${package2}.${package3}.service.${table.name2}Service;
import java.util.Map;
import com.arpgalaxy.manager.pojo.${table.name2};
import java.util.List;

/**
 * @author arpgalaxy
 * @date 2021/3/12
 * @email 13605560342@163.com
 * @description
 */
@RestController
@RequestMapping("/${module}/${table.name?lower_case}")
public class ${table.name2}Controller {

    @Autowired
    ${table.name2}Service ${table.name2?uncap_first}Service;

    @RequestMapping("/list")
    public List<${table.name2}> select${table.name2}s(Integer start,Integer limit) {
        return ${table.name2?uncap_first}Service.select${table.name2}s(null,null);
    }
<#if table.key!="">
    @RequestMapping("/selectByPrimaryKey")
    public Object selectByPrimaryKey(@RequestParam Map<String,String> map){
    <#list table.columns as column>
        <#if column.columnKey=='PRI'>
        ${column.javaType} ${column.variableName} = ${column.javaType}.valueOf(map.get("${column.variableName}"));
        </#if>
    </#list>
        return ${table.name2?uncap_first}Service.selectByPrimaryKey(<#list table.columns as column><#if column.columnKey=='PRI'><#if column?counter!=1>,</#if>${column.variableName}</#if></#list>);
    }
</#if>
}
